package com.sym.architecture.utils

import android.content.Context
import android.content.pm.PackageInfo
import android.util.Log

object AppUtils {

    /**
     * 遍历手机内的所有应用
     */
    fun getAllApps(context: Context, app_flag_1: String, app_flag_2: String): PackageInfo? {

        val packageManager = context.packageManager
        val installedPackages = packageManager.getInstalledPackages(0)
        for (pak in installedPackages) {
            Log.i("SYM",pak.packageName)
            if (pak.packageName.contains(app_flag_1) || pak.packageName.contains(app_flag_2)) {
                return pak
            }
        }
        return null
    }
}